package com.myutils;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;

public class WebServiceClientUtil {
	
	public static String callService(String wsdlUrl, String method, Object... arg) throws Exception {
		String result = "";
		try {
			DynamicClientFactory dcf = DynamicClientFactory.newInstance();
			Client client = dcf.createClient(wsdlUrl);
			Object[] res = client.invoke(method, arg);
			result = (String)res[0];
		} catch (Exception e) {
			throw e;
		}
		return result;
	}
}
